JavaScript: The Ultimate Beginner's Guide! by Andrew Johansen

JavaScript: The Ultimate Beginner's Guide! by Andrew Johansen
Author: Andrew Johansen [Johansen, Andrew]
Language: eng
Format: epub
Published: 2016-01-23

The Different Types of Exceptions

In JavaScript, you can throw any type of object. However, thrown objects may possess different characteristics. Although it is usual to throw strings and/or numbers as error messages, it is usually more beneficial to utilize the exception types designed for this purpose. Here are two of the most popular exceptions in JavaScript:

DOMError – This exception represents a named error object.

DOMException - This exception indicates an abnormal situation that happens while a property or method is being used. To use this exception, you must add DOMError() into your code.